// API响应基础结构
export interface ApiResponse<T = any> {
  code: number
  message: string
  data: T
}

// 分页响应结构
export interface PaginationResponse<T> {
  items: T[]
  total: number
  page: number
  page_size: number
}

// 用户相关类型
export interface User {
  id: number
  username: string
  email: string
  nickname: string
  avatar: string
  bio: string
  status: number
  created_at: string
  updated_at: string
}

export interface UserRegisterRequest {
  username: string
  email: string
  password: string
  nickname?: string
}

export interface UserLoginRequest {
  username: string
  password: string
}

export interface UserLoginResponse {
  token: string
  user: User
}

export interface UserProfileResponse {
  id: number
  username: string
  email: string
  nickname: string
  avatar: string
  bio: string
}

export interface UserUpdateRequest {
  nickname?: string
  avatar?: string
  bio?: string
}

// 文章相关类型
export interface Article {
  id: number
  title: string
  content: string
  summary: string
  cover_image: string
  author_id: number
  status: number
  view_count: number
  like_count: number
  tags: string
  created_at: string
  updated_at: string
  published_at?: string
  author?: User
}

export interface ArticleCreateRequest {
  title: string
  content: string
  summary?: string
  cover_image?: string
  status: number
  tags?: string
}

export interface ArticleUpdateRequest {
  title?: string
  content?: string
  summary?: string
  cover_image?: string
  status?: number
  tags?: string
}

export interface ArticleListResponse {
  articles: Article[]
  total: number
  page: number
  page_size: number
}

// 文件上传相关类型
export interface FileUploadResponse {
  id: number
  file_name: string
  file_url: string
  file_size: number
  file_type: string
}

// 测试相关类型
export interface Test {
  id: number
  test: string
  author_id: number
  created_at: string
  updated_at: string
  published_at?: string
  author?: User
}

export interface TestCreateRequest {
  id?: number
  test: string
}

export interface TestUpdateRequest {
  id?: number
  test: string
}

export interface TestListRequest {
  test?: string
  page?: number
  page_size?: number
}

export type TestListResponse = Test[]
